FC = mpif90

OPTFLAGS = -O2
DEBUGFLAGS =
FCFLAGS = $(OPTFLAGS) $(DEBUGFLAGS) $(F90FLAGS) -warn all

LFLAGS = -lm
LDFLAGS  = $(LFLAGS) $(LINK_MPIS) -mcmodel medium -shared-intel
OTHERFLAGS = $(IFLAGS)

SOURCES = nrtype.f90 nrutil.f90 binom.f90 grid.f90 grid_interpolation.f90 parameters_energy.f90 parameters.f90 functions.f90 \
randu.f90 rouwenhorst.f90 spline_linear_val.f90 lambda2_optimizer.f90 retired_valuer.f90\
working_valuer.f90 qsort.f90 hetero_ss.f90

OBJECTS = $(SOURCES:.f90=.o)
EXEC = steady_state

%.o: %.f90
	$(FC) $(FCFLAGS) -c $<

all: $(EXEC)

$(EXEC):$(OBJECTS)
	$(FC) $(FCFLAGS) -o $(EXEC) $(OBJECTS) $(LDFLAGS)

clean:
	-$(RM) $(OBJECTS) $(EXEC) *.mod
